package chapter01

object Test19_NineTower {
  def main(args: Array[String]): Unit = {
    for(i<-1 to 9){
      for(k<-i to 8){//9-行号个空格
        print(" ")
      }
      for(j<-1 to i){//行号个数的*
        print("*")
      }
      for(n<- 1 until i){//补充的* 个数为行号-1个*
        print("*")
      }
      println()
    }
    //使用字符串乘法 可以重复输出字符串
    for(i<- 1 to 9) println(" "*(9-i)+"*"*i+"*"*(i-1))
    //生成序列
    val ints = for (i <- Range(1, 5)) yield i * 2
    println(ints)
    for(i <- ints){
      println(i)
    }
  }
}
